package Dao;


import java.sql.*;
import java.util.ArrayList;

public class TEST {
    public static void main(String[] args) throws ClassNotFoundException, SQLException {
        Class.forName("com.mysql.jdbc.Driver");
        Connection con;String sql;
        PreparedStatement preparedStatement;
        con= DriverManager.getConnection("jdbc:mysql://localhost:3306/it?useUnicode=true&characterEncoding=utf8",
                "root","123456");
        sql="select * from login where name= ?";
        preparedStatement=con.prepareStatement(sql);
        String name="覃韦越",password="123456";
        ResultSet resultSet;
        preparedStatement.setString(1,name);

        resultSet=preparedStatement.executeQuery();
        boolean login=false;
        while (resultSet.next()){
            String find_password=resultSet.getString("password");
            if(find_password.equals(password)){
                login=true;
                break;
            }
        }
    }

}
